package com.sfc.sdsr.common.model;

import java.io.Serializable;
import java.util.UUID;

public class Person implements IFileDao, Serializable, Comparable<Person> {
	
	private static final long serialVersionUID = 0xDEADBEEFBABE0004L;

	private UUID personUuid;
	private String firstName;
	private String lastName;
	private String middleName;
	private String nickName;
	private Address address;
	private Occupation occupation;
	private SfcRole sfcRole;
	private long utcBirthDate;
	private long utcJoinDate;
	private String extraString;
	
	public UUID getPersonUuid() {
		return personUuid;
	}

	public void setPersonUuid(UUID personUuid) {
		this.personUuid = personUuid;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getMiddleName() {
		return middleName;
	}

	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public Occupation getOccupation() {
		return occupation;
	}

	public void setOccupation(Occupation occupation) {
		this.occupation = occupation;
	}

	public SfcRole getSfcRole() {
		return sfcRole;
	}

	public void setSfcRole(SfcRole sfcRole) {
		this.sfcRole = sfcRole;
	}

	public long getUtcBirthDate() {
		return utcBirthDate;
	}

	public void setUtcBirthDate(long utcBirthDate) {
		this.utcBirthDate = utcBirthDate;
	}

	public long getUtcJoinDate() {
		return utcJoinDate;
	}

	public void setUtcJoinDate(long utcJoinDate) {
		this.utcJoinDate = utcJoinDate;
	}

	public String getExtraString() {
		return extraString;
	}

	public void setExtraString(String extraString) {
		this.extraString = extraString;
	}

	@Override
	public String getPrimaryKey() {
	    return (this.firstName + this.lastName).toLowerCase();
	}
	
	@Override
	public int compareTo(Person person) {
		if (this == person) {
			return 0;
		}
		
		String otherPrimaryKey = person.getPrimaryKey();
		String thisPrimaryKey = this.getPrimaryKey();
		
		return thisPrimaryKey.compareTo(otherPrimaryKey);
	}

    @Override
    public String toString() {
        return "Person: " + this.firstName + " " + this.lastName;
    }

}
